package com.hnust.api;

import com.github.lianjiatech.retrofit.spring.boot.annotation.RetrofitClient;
import com.hnust.domain.*;
import okhttp3.MultipartBody;
import okhttp3.RequestBody;
import okhttp3.MultipartBody;
import okhttp3.ResponseBody;
import org.springframework.stereotype.Component;
import retrofit2.Call;
import retrofit2.http.*;


import java.io.File;
import java.util.List;

/**
 * 创建人：zhangRuWang
 * 创建时间：2020/10/28
 * 描述：
 */
@RetrofitClient(baseUrl = "${retrofit.baseUrl}",poolName = "test1",readTimeoutMs = 50000,writeTimeoutMs = 50000,connectTimeoutMs = 50000)
@Component
public interface SubjectApi {
    @GET("/download/question")
    Call<ResponseBody> getTem();

    @Multipart
    @POST("/upload/questions")
    Call<Result<List<BulkImport>>> upload(@Part MultipartBody.Part file, @Part("courseId") RequestBody courseId);

//    @Multipart
//    @POST("/upload/questions")
//    Call<Result<List<BulkImport>>> upload(@Part("file") MultipartBody.Part file, @Part("courseId")String courseId);
//    @GET("/delCourseSub")
//    Call<Result<File>> delCourseSub(@Query ("paperId")subject_id,id,token );
    //获取老师的所有课程
    @GET("/api/subject/getCourseData")
    Call<Result<List<CourseData>>> getCourseData(@Query("id") String id,@Query("token") String token);
    //删除题目
    @GET("/api/subject/delCourseSub")
    Call<Result> delCourseSub(@Query("subject_id") String subject_id,@Query("id") String id,@Query("token") String token);

    //修改题目信息 subjectData,token,id
    @POST("api/subject/updateSubInfo")
    Call<Result<String>> updateSubInfo(@Body SubjectDataReq subjectDataReq);

    //上传到数据库
    @POST("/api/subject/addSub")
    Call<Result> addSub(@Body SubjectDataListReq subjectDataListReqs);

    @GET("api/subject/getCourseSubByCon")
    Call<Result<List<SubjectTest>>> getCourseSub(@Query("course_id")String courseId,@Query("id")String id,
                                                 @Query("token")String token,@Query("currentPage")Integer currentPage,
                                                 @Query("rows")Integer rows,@Query("keyword")String keyword);

    @GET("api/subject/getCourseTargetList")
    Call<Result<List<CourseTargetRecord>>> getCourseTargetRecord(@Query("course_id")String courseId,@Query("id")String id,@Query("token")String token);

    @GET("api/subject/getCourseChapterList")
    Call<Result<List<CourseChapter>>> getCourseChapterList(@Query("course_id")String course_id,
                                                           @Query("token")String token,
                                                           @Query("id") String id);
    @GET("api/teacher/testpaper/getQuesTypeList")
    Call<Result<List<QuestionTypeRecord>>> getQuesTypeList(
            @Query("token") String token,
            @Query("id") String id
    );
}
